home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: MegaDisc
/
MegaDisc 27 (1992-03)(MegaDisc Digital Publishing)(AU)(Disk 1 of 2)[WB].zip
/
MegaDisc 27 (1992-03)(MegaDisc Digital Publishing)(AU)(Disk 1 of 2)[WB].adf
/
Tutes_&_CLI
/
Basic_Programming
/
Basic_Programming
Wrap
Text File
|
1992-03-30
|
9KB
|
171 lines
PAINLESS PROGRAMMING IN AmigaBASIC
by Keith Antoine
Ed: Here is a tutorial for beginners who want to get into Basic - it
covers how to set up a Basic disk, and start off programming.
(( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 ))
I have been for some time trying to program in the "simple" AmigaBasic,
quite unsuccessfully I might say. The why's and wherefore's are that the
language was never written with the idea of being able to use the more
powerful interfaces of the Amiga without a great deal of trouble. There
have appeared from time to time what appeared to many as the answer, in the
form of other languages such as AMOS, but theses like C and assembler take
time to learn. There is also the drawback of the writers of such languages
being unable to either speak or write in ENGLISH so as lay-people can
understand what they are saying. It would seem as if they never attended
either school or English classes, and therefore it should be a rule that
the developers themselves not be allowed near the writing of manuals.
It was with some suprise one day whilst looking through a catalogue of
public domain for examples of C, so as I might edify myself, that I came
across a program called "Basic Gadgets" by Bryan D. Catley. I thought
that if one person can program using the intuition so easily then others
may have done so also, using other equally difficult libraries, etc in a
simple way so as I could use and understand them. So the search began
for the holy program.
Let us start from the beginning. I am 58 and had a decent education but I
have become recently unemployed and in the present economic climate I have
as much hope of being re-employed as I have of becoming Prime Minister of
Australia, actually the latter would be more obtainable. I had purchased
in July 1990 an Amiga 500 plus printer- external drive - monitor -0.5meg
memory expansion and as I was very interested in Astrology as well and
wanted to take the hard work out of it I thought I will write my own
program!! OK! you can all stop laughing. I had owned a Vic 20 and a C64
previously and I had read the small manual that came with the Vic 20 and I
imagined it was a simple task - how wrong can you be. Eighteen months
later I purchased the astrology programs admitting defeat over what was
after all a gigantic task.
I was still interested in programming, but with greatly reduced horizons
and a better understanding of the subject and why many books start off with
"HELLO WORLD" type programs, which I thought were beneath me. I have
nearly finished my first program and another on the way, but they would not
have got off the ground if it were not for the people who put their work
into public domain. I actually found many such programs were available
based on advanced basic using libraries which can be called as sub
programs. [Ed: on this subject, see the "Basic_Routines" drawer this
issue.]
Practical Stuff
It is a good idea to keep on a disk/s the various sub programs and
procedures/modules that you use often, to save typing. One of the best PD
text editors, in my opinion, available to a programmer is AZ. This is the
only PD editor to have two windows available and therefore you can cut and
paste between two separate documents this enables you to join parts of or
whole programs together without using MERGE or JOIN. In other words it
makes programming a breeze and not a chore.
No Bugs?
Programming must be for the amateurs like us, a relaxation the culmination
of which is to see something you put many hours of BLOOD SWEAT AND TEARS
into working on the screen. I suppose I am something of a perfectionist
therefore make sure before you let anyone else use your program that there
are no bugs in it and it is the best work you can produce. I am sick to
death after paying good money for either PD or commercial programs to find
they do not work properly, hence let us lowly types who program in basic
show the rest of the programming fraternity the right way to do things.
Books to use
Now the first recommendation I have is throw away the Commodore booklet on
Amiga Basic aqnd purchase three books two by Abacus, "Amiga Basic Inside
and Out" and also "Amiga Tricks and Tips", plus the accompanying Disks. I
would also reccommend by Compute "Advanced Amiga Basic" - these will give
you a good grounding in the language.
The AmigaBasic interpreter is a necessary evil during the formation period
of your program but only in a minor way. It is slow and by no means as
efficient as an ASCII text editor such as QED or AZ which are both PD. So
firstly we will make up a disk specifically for the program you are going
to write. Firstly it does not need to be bootable, initially, but as you
will eventually want it to be we will make it so.
Making a special disk
Format any disk and install it; to help I suggest another PD Program
called Formatter which if you select the drive you have your disk in and
then select fast format and install, click on start, your disk will be
processed in about 4secs. A PD program entitled SID [Ed: on our PD disk UT
164] is a veritable workhorse for anyone with a computer and indispensable
to programmers but please READ the documents. SID can be configured by you
to your requirements but more of this later we will use it as is for now.
Click on the icon for SID and it will open with a split screen put in your
programming disk and workbench disk in df1; immediateley below the screens
is a line of gadgets the first being RAM and reapeating itself from the
centre again, click on df0 for the left and df1 for the right. This means
that your programming disk on the left screen is blank except for an .
.info file whilst on the right is workbench in all its glory and with files
you do not see normally, as some do not have icons on workbench to display
them. In the righthand screen, using the mouse click on the following
orange coloured directories:- C, DEVS, FONTS, l, LIBS, S, SYSTEM these
should become highlighted; as soon as this happens click on the gadget that
is labeled copy this is situated just to the left of centre screen. When
the directories have copied across eject workbench from df1 and replace
with the extras disk click on the df1 gadget on the right again to display
the disk and copy across as previously the files AmigaBASIC and
AmigaBASIC.info - these are in white immediately below the orange
directories.
Quit SID and reset the Amiga and boot up with your new programming disk
click on the AmigaBASIC icon to open the interpreter and you will be
presented with a double screen one on the left named "basic" and the other
"list". The list screen will be active with a cursor in the top lefthand
corner.
Type the following in and press RETURN at the end of
each line:- CLEAR ,40000&
'***************************
'{ the name of the program}
'{ the date}
'By {your name}
'O/S Version {1.3 or 2,04}
'{the type of program}i.e,GAME,UTILITY,PICTURE
SAVER etc
'***************************
At this point it is essential that what you have typed in is saved as an
ASCII file and not as an AmigaBASIC file so therefore click in the left
side window labeled basic and type in as follows and press return:-
save "{your programs name}",a
In future you will just select SAVE and the program will be saved
automatically as an ASCII file, and now in future all listing for the
program will be done from the text editor and you will only use the Basic
Interpreter to run the program. This is achieved by double clicking on
the program icon to load into the BASIC interperater or loading into your
favorite Text Editor.
It does not matter which of the languages you set out to use you will have
to learn the syntax and the peculiarities of that language and, I am sure
you are aware that some are more difficult to grasp than others. With this
in mind I would suggest at this point you purchase, beg, borrow at least
one of the aformentioned books and digest its contents before the next
issue of MEGADISK. I will be going into more detail in the next issue on
the programs available, both commercially and in PD, that will assist you
in writing more powerful code without having to learn too much computerese.
TO BE CONTINUED
I am Keith Antoine and available on (07) 300 2161 most days or 18 Arkana
Street, The Gap, Brisbane, QLD 4061
(( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 ))